package io.gitee.yth.design.pattern.test.core.pattern.creational.builder;

/**
 * 建造房子的具体逻辑交给指挥者决定
 *
 * @author yth
 * @since 2023-04-24-17:32
 */
public class HouseDirector {

    private final AbstractHouseBuilder houseBuilder;

    /**
     * 可以通过构造器传入builder，也可以通过setter
     */
    public HouseDirector(AbstractHouseBuilder houseBuilder) {
        this.houseBuilder = houseBuilder;
    }

    public House construct() {
        houseBuilder.buildBasic();
        houseBuilder.buildWall();
        houseBuilder.buildRoofed();
        return houseBuilder.build();
    }

}
